Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lib/inspec-objects.rb so inspec-objects can be required #3

Open
wants to merge 27 commits into
base: main
Choose a base branch
from

Conversation

lukemalinowski
Copy link

Description

Previously, require "inspec-objects" would throw an error. With this
commit the gem can be pulled in directly.

Related Issue

Possible Fix for #2

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New content (non-breaking change)
  • Breaking change (a content change which would break existing functionality or processes)

Checklist:

  • I have read the CONTRIBUTING document.

Previously, require "inspec-objects" would throw an error. With this
commit the gem can be pulled in directly.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the
    best of my knowledge, is covered under an appropriate open
    source license and I have the right under that license to
    submit that work with modifications, whether created in whole
    or in part by me, under the same open source license (unless
    I am permitted to submit under a different license), as
    Indicated in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including
    all personal information I submit with it, including my
    sign-off) is maintained indefinitely and may be redistributed
    consistent with this project or the open source license(s)
    involved.

Signed-off-by: Luke Malinowski <[email protected]>
@Bialogs
Copy link

Bialogs commented Apr 2, 2020

As long as there is an inspec/objects folder this will never reliably import the inspec/objects from this gem. This is because there is no 'root' file such as the one @lukemalinowski added to differentiate between these objects and the objects in inspec & inspec-core that are deprecated.

I believe that one of the following needs to happen:

  1. inspec & inspec-core needs to remove the folder inspec/objects. It has the same exact folder structure as this gem, with the same files in it. It may be loaded over this gem without anyone realizing it. If this folder is removed, Ruby will fail a require on inspec & inspec-core and go to this gem instead.
  2. merge this pull request so that the namespace in the $LOAD_PATH is different preferred option
  3. Reorganize the folder structure of this gem to be inspec/<unique_name_that_is_not_in_inspec_dependency>/*.rb

Option 2 is the preferred option because it provides this repository the most control - with option 3 there may be a chance where the unique name

Robert Clark and others added 26 commits April 2, 2020 13:28
When using autoload, the path was nondeterministic since the inspec/objects folder would sometimes be loaded. This moves over to using require_relative which guarantees we are loading from inspec_objects. Note that some imports had to be reordered since they were dependent on one another.
- added Bundle file
- added cookstyle
- ran the rake unit tests
- inital support for adding headers to controls
- simplifed logic for adding the header per peer review
- implementation is a basic string block
- Setup unit tests and linting for project
- added Bundle and added cookstyle
- ran the rake unit tests

Signed-off-by: Aaron Lippold <[email protected]>
* Post-Body Object

- added inital object for post body of a control
- a post-body should usually be a block of ruby/inspec code
- the assumption will be that we just dump it as is into the control

Signed-off-by: Aaron Lippold <[email protected]>

* updated .gitignore file
removed .vscode dir from repo

Signed-off-by: Aaron Lippold <[email protected]>

* added an ignore to our rubocop file given testing issues and whitespace
using standard linting gem that the chef folks used before

Signed-off-by: Aaron Lippold <[email protected]>
This reverts commit 722093e.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants